#ifndef __MCS__SCRIPT_EXCEPTION__HPP
#define __MCS__SCRIPT_EXCEPTION__HPP

#include "Exception.hpp"
#include "SourceLocation.hpp"

class ScriptException : public Exception
{
public:
	ScriptException() {}
	~ScriptException() {}

	virtual ScriptException * clone() const = 0;
};

class ScriptExceptionException : public Exception
{
public:
	ScriptExceptionException(SourceLocation const & location, ScriptException const & ex)
		: Exception()
		, location_(location)
		, ex_(ex.clone())
	{

	}

	virtual std::ostream & stream(std::ostream & str) const
	{
		return str << location_ << "Script error: " << *ex_;
	}
private:
	SourceLocation location_;
	ScriptException * ex_;
};

#endif //__MCS__SCRIPT_EXCEPTION__HPP
